package com.example.openfeign;

import com.example.openfeign.remoteService.RemoteServiceDemo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@RestController
public class OpenfeignApplication {
    private static final Logger log = LoggerFactory.getLogger(OpenfeignApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(OpenfeignApplication.class, args);
    }

    @Autowired
    private RemoteServiceDemo remoteServiceDemo;

    @GetMapping("/feign")
    public String test() {
        log.info("开始访问请求");
        return remoteServiceDemo.echo();
    }

}
